
 /*
 * Product object constructor
 */
/*
 function Product(productName, productID, productHref){
	this.productName = productName;
	this.productID = productID;
	this.productHref  = productHref;
	this.locations = new Array();

	this.count = 0;
	*//*this.location = new Array(locationArray.length);
	for(i=0; i<locationArray.length; i++){
		this.location[i] = locationArray[i];
	}*//*
}

	*//**
	** Product object methods starts here
	**
	**//*
//alert("Product Entering");

	Product.prototype.getName = function(){
		return this.productName ;
	}

	Product.prototype.getID = function(){
		return this.productID;
	}
	
	Product.prototype.getHref = function(){
		return this.productHref;
	}

	Product.prototype.addLocation = function(location){
		this.locations[this.count]= location;
		this.count++;
		//alert("Location = "+location+"Count = "+ this.count);
	}

	Product.prototype.getLocations = function(){
		return this.locations;
	}

	Product.prototype.getLocationNames = function(){
		var arrayLoc = new Array(this.locations.length);
		for(i=0; i<this.locations.length; i++){
			arrayLoc[i] = this.locations[i].getName();
		}
		return arrayLoc;
	}

	Product.prototype.getLocationIDs = function(){
		var arrayLoc = new Array(this.locations.length);
		for(i=0; i<this.locations.length; i++){
			arrayLoc[i] = this.locations[i].getID();
		}
		return arrayLoc;
	}

	Product.prototype.getLocationHrefs = function(){
		var arrayLoc = new Array(this.locations.length);
		for(i=0; i<this.locations.length; i++){
			arrayLoc[i] = this.locations[i].getHref();
		}
		return arrayLoc;
	}

	Product.prototype.getLots = function(locName){
		return this.locations[locName].getLots();
	}

	Product.prototype.getLotNames = function(locName){
		return this.locations[locName].getLotNames();
	}

	Product.prototype.getLotIDs = function(locName){
		return this.locations[locName].getLotIDs();
	}

	Product.prototype.getLotHrefs = function(locName){
		return this.locations[locName].getLotHrefs();
	}*/
//alert("Product Exiting");

//============todo need to remove above code as it is not used anywhere
var ct = ct || {};
ct.product = {

	/**
	 * Registers a Product
	 *
	 * @param key the key
	 * @param Product the Product to register
	 */
	register : function(key, product) {
		this.internal.add(key, product);
	},

	/**
	 * Unregisters a product by key.
	 *
	 * @param key the key
	 */
	unregister : function(key) {
		this.internal.remove(key);
	},

	/**
	 * Gets a registered Product by key.
	 *
	 * @param key the key
	 */
	getProduct : function(key) {
		var product = this.internal.find(key);
		if ( !product ) {
			//product not found.
		}

		return product;
	}
};

/**
 * Product object
 */
ct.Product= function() {
    this.mfgPartNumber = '';
    this.mktgPartNumber = '';

	if ( (arguments.length == 2) ) {
        this.mfgPartNumber = arguments[0];
		this.mktgPartNumber = arguments[1];
	}
};
/**
 * Set up the internal section and our requirements
 */

ct.product.internal = {

	/**
	 * Products.
	 */
	products: {},


	/**
	 * Add a Product.
	 *
	 * @param key the key
	 * @param product the product to add
	 */
	add: function(key, product) {
		this.products[key] = product;
	},

	/**
	 * Remove a product.
	 *
	 * @param key the key of the product to remove
	 */
	remove: function(key) {
		delete this.products[key];
	},

	/**
	 * Find a Product by key
	 *
	 * @param key the key of the product to find
	 */
	find: function(key) {
		return this.products[key];
	}
};

